<template>
  <div class="stadium_details">
    <!-- 场馆详情-头部导航栏 -->
   <van-nav-bar
      title="场馆详情"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
      fixed
      placeholder
    />
    <div>
      <van-empty v-if="!venueData" description="无数据" />
    </div>
    <div v-if="venueData">
    <!-- 场馆详情轮播图 -->
    <van-swipe class="my-swiper" :autoplay="3000" indicator-color="white">
      <van-swipe-item><img :src="venueData[0].venue_details_imgs1" alt=""></van-swipe-item>
      <van-swipe-item><img :src="venueData[0].venue_details_imgs2" alt=""></van-swipe-item>
      <van-swipe-item><img :src="venueData[0].venue_details_imgs3" alt=""></van-swipe-item>
      <van-swipe-item><img :src="venueData[0].venue_details_imgs4" alt=""></van-swipe-item>
    </van-swipe>
    <!-- 场馆介绍 -->
     <div class="title stadium_introduce">
        <span>
          <img src="../assets/u286.png" alt="" />
        </span>
        <span>场馆介绍</span>
      </div>
    <div>
        <p> {{venueData[0].venue_details_text1}}</p>
    </div>
    <div style="margin: 20px; ">
    <van-image
  width="20rem"
  height="10rem"
  fit="contain"
  :src="venueData[0].venue_det_img1"
/>
</div>
<div>
    <p >{{venueData[0].venue_details_text2}}</p>
    </div>
    <div style="margin: 20px; ">
    <van-image
  width="20rem"
  height="10rem"
  fit="contain"
  :src="venueData[0].venue_det_img2"
/>
</div>
<div>
    <p>{{venueData[0].venue_details_text3}}</p>
</div>
 <div class="title stadium_address" >
        <span>
          <img src="../assets/u286.png" alt="" />
        </span>
        <span>场馆地址</span>
        <van-button :disabled="venueData[0].venue_status === '0'" class="stadium_class_btn" type="info" @click="goClass($route.params.vid)">预约课程</van-button>
      </div>
<!-- 底部评价 -->
      <div class="evaluate">
        <div class="evaluate_posation">
        <van-icon name="location-o" /> <span>{{venueData[0].venue_adress}}</span>
        </div>
        <div class="evaluate_phone">
        <van-icon name="phone-o" /> <span>{{venueData[0].venue_phone}}</span>
        </div>
        <div>
        <van-icon name="good-job-o" /><van-rate v-model="value" allow-half void-icon="star" void-color="#eee"  color="#39a9ed" />好评
        </div>
      </div>
      </div>
  </div>
</template>

<script>
import {venueDetail} from "../http/api";

export default {
  data() {
    return {
      current: 0,
      /* 星星数量 */
      value: 0,
      venueData: ''
    }
  },
  methods: {
    onChange(index) {
      this.current = index
    },
    onClickLeft() {
      this.$router.go(-1)
    },
    venueDetails(id) {
      venueDetail({vid: id}).then(res => {
        this.venueData = res.data.data
        this.value =parseFloat(res.data.data[0].venue_star)
      })
    },
    goClass(id) {
      this.$router.push(`/leisureclass/${id}`)
    }
  },
  /* 接收参数测试 */
  mounted() {
    this.venueDetails(this.$route.params.vid)
  }
}
</script>

<style scoped>
.my-swipe .van-swipe-item {
    color: #fff;
    font-size: 20px;
    line-height: 150px;
    text-align: center;
    background-color: #39a9ed;
  }
  .evaluate{
    margin: 10px;
  }
  .evaluate_posation,.evaluate_phone{
    margin-bottom: 10px;
  }
  p{
    text-indent:2em
  }
  .stadium_introduce,.stadium_address{
    border: 1px solid rgb(233,233,233);
    height: 40px;
    line-height: 40px;
  }
  .title{
    margin: 3px 0 0 0;
  }
  .title img{
    margin-top: 7px;
  }
  .stadium_address{
    position: relative;
  }
  .stadium_class_btn{
    position: absolute;
    left: 70%;
    height: 85%;
    }
</style>
